package com.example.demo.controller;

import com.example.demo.entity.HotelOrder;
import com.example.demo.service.impl.HotelOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hotelOrder")
public class HotelOrderController {
    private HotelOrderService hotelOrderService;
    @Autowired
    public void setHotelOrderService(HotelOrderService hotelOrderService) {
        this.hotelOrderService = hotelOrderService;
    }

    //生成酒店订单
    @RequestMapping("/add")
    public String addOrder(HotelOrder hotelOrder){
        System.out.println(hotelOrder);
        int count = hotelOrderService.reserve(hotelOrder);
        if(count > 0){
            return "ok";
        }else{
            return "error";
        }
    }
}
